<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-18 20:22:54
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-18 20:29:04
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* aabccd，去掉重复的字符，使结果显示 abcd */
        function fixChar(str){
            var strNew=new Array();
            for(var i=0;i<str.length;i++){
                if(strNew.indexOf(str[i])===-1){
                    strNew.push(str[i]);
                }
            }  
            return strNew 
        }
        var str='aabccd';
       console.log(fixChar(str));
        
    </script>
</body>
</html>